




<p-table #dt [columns]="cols" [value]="admins" selectionMode="single" [(selection)]="selectedAdmin" (onRowSelect)="onRowSelect($event)" [paginator]="true" [rows]="15">
  <ng-template pTemplate="caption">
    用户权限管理
    <div style="text-align: right">
      <i class="fa fa-search" style="margin: 20px 4px 0 0"></i>
      <input type="text" pInputText size="50" placeholder="Global Filter" (input)="dt.filterGlobal($event.target.value, 'contains')" style="width: auto">
    </div>
  </ng-template>
  <ng-template pTemplate="header" let-columns>
    <tr>
      <th *ngFor="let col of columns" [pSortableColumn]="col.field">
        {{col.header}}
        <p-sortIcon [field]="col.field"></p-sortIcon>
      </th>
    </tr>
    <!--<tr>-->
    <!--<th *ngFor="let col of columns" [ngSwitch]="col.field">-->
    <!--<input *ngSwitchCase="'satrt_time'" pInputText type="text" (input)="dt.filter($event.target.value, col.field, col.filterMatchMode)">-->
    <!--<input *ngSwitchCase="'end_time'" pInputText type="text" (input)="dt.filter($event.target.value, col.field, col.filterMatchMode)">-->
    <!--<input *ngSwitchCase="'days'" pInputText type="text" (input)="dt.filter($event.target.value, col.field, col.filterMatchMode)">-->
    <!--<input *ngSwitchCase="'reason'" pInputText type="text" (input)="dt.filter($event.target.value, col.field, col.filterMatchMode)">-->
    <!--<input *ngSwitchCase="'des'" pInputText type="text" (input)="dt.filter($event.target.value, col.field, col.filterMatchMode)">-->
    <!--</th>-->
    <!--</tr>-->
  </ng-template>
  <ng-template pTemplate="body" let-rowData let-columns="columns">
    <tr [pSelectableRow]="rowData">
      <td *ngFor="let col of columns">
        {{rowData[col.field]}}
      </td>
    </tr>
  </ng-template>
  <ng-template pTemplate="summary" let-rowData>
    <div style="text-align:left">
      <button type="button" pButton icon="fa fa-plus" (click)="showDialogToAdd()" label="Add"></button>
    </div>
  </ng-template>
</p-table>

<p-dialog header="OutRecord Details" [(visible)]="displayDialog" [responsive]="true" showEffect="fade" [modal]="true" [width]="300">
  <div class="ui-g ui-fluid" *ngIf="admin">
    <div class="ui-g-12">
      <div class="ui-g-4">
        <label for="admin_id">用户编号</label>
      </div>
      <div class="ui-g-8">
        <input  pInputText id="admin_id" [(ngModel)]="admin.admin_id" />
      </div>
    </div>
    <div class="ui-g-12">
      <div class="ui-g-4">
        <label for="admin_name">用户名</label>
      </div>
      <div class="ui-g-8">
        <input pInputText id="admin_name" [(ngModel)]="admin.admin_name" />
      </div>
    </div>
    <div class="ui-g-12">
      <div class="ui-g-4">
        <label for="admin_pwd">用户密码</label>
      </div>
      <div class="ui-g-8">
        <input pInputText id="admin_pwd" [(ngModel)]="admin.admin_pwd" />
      </div>
    </div>
    <div class="ui-g-12">
      <div class="ui-g-4">
        <label for="admin_state">用户等级</label>
      </div>
      <div class="ui-g-8">
        <input pInputText id="admin_state" [(ngModel)]="admin.admin_state" />
      </div>
    </div>
  </div>
  <p-footer>
    <div class="ui-dialog-buttonpane ui-helper-clearfix">
      <button type="button" pButton icon="fa fa-close" (click)="delete()" label="Delete"></button>
      <button type="button" pButton icon="fa fa-check" (click)="save()" label="Save"></button>
    </div>
  </p-footer>
</p-dialog>

